using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAL;

namespace BUS
{
    public class CommentBUS
    {
        public static void Insert(tbComment Comment)
        {
            CommentDAL cmdal = new CommentDAL();
            cmdal.Insert(Comment);
        }
        public static void Update(tbComment Comment)
        {
            CommentDAL cmdal = new CommentDAL();
            cmdal.Update(Comment);
        }
        public static void Delete(int iD)
        {
            CommentDAL cmdal = new CommentDAL();
            cmdal.Delete(iD);
        }
        public static tbCommentcollection GET(string Where, int PageIndex, int PageSize,
                                        string OrderBy, string OrderDirection,
                                        out int TotalRecords)
        {
            CommentDAL cmdal = new CommentDAL();
            return cmdal.GET(Where, PageIndex, PageSize,
                            OrderBy, OrderDirection, out TotalRecords);
        }
        public static tbComment GetByID(int iD)
        {
            int t = 0;
            CommentDAL cmdal = new CommentDAL();
            tbCommentcollection Commentcollection = cmdal.GET("where " + tbCommentcolumn.idcomment.ToString() + " = " + iD.ToString(), 0, 0,
                tbCommentcolumn.comment.ToString(), "ASC", out t);
            if (Commentcollection.Count == 1)
                return Commentcollection[0];
            return null;
        }
        public static tbCommentcollection GetAll()
        {
            int t = 0;
            CommentDAL cmdal = new CommentDAL();
            return cmdal.GET("where 1=1", 0, 10,
                tbCommentcolumn.comment.ToString(), "ASC", out t);
        }
    }
}
